/**************************************************************************
 *
 * Copyright 2014 LunarG, Inc.  All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * This file was originally authored by Ian Elliott (ian@lunarg.com).
 *
 **************************************************************************/

/* Note: this file is used to implement a special "pattern" that's used by the
 * pxfmt conversion code.  That code needs to convert from a run-time knowledge
 * of an PXFMT_* enum value (e.g. PXFMT_R8_UNORM) to a compile-time instance of
 * a templatized function.
 *
 * Before #include'ing this file, the CASE_STATEMENT(fmt) macro needs to be
 * #define'd, and the #include of this file needs to exist within the context
 * of a switch statement.  For example:
 *
 *    #define CASE_STATEMENT(fmt) case fmt: do_something<fmt>(); break;
 *    switch (fmt)
 *    {
 *    #include "pxfmt_case_statements.inl"
 *    }
 */

// GL_RED
CASE_STATEMENT(PXFMT_R8_UNORM);
CASE_STATEMENT(PXFMT_R8_SNORM);
CASE_STATEMENT(PXFMT_R16_UNORM);
CASE_STATEMENT(PXFMT_R16_SNORM);
CASE_STATEMENT(PXFMT_R32_UNORM);
CASE_STATEMENT(PXFMT_R32_SNORM);
CASE_STATEMENT(PXFMT_R16_FLOAT);
CASE_STATEMENT(PXFMT_R32_FLOAT);

// GL_GREEN
CASE_STATEMENT(PXFMT_G8_UNORM);
CASE_STATEMENT(PXFMT_G8_SNORM);
CASE_STATEMENT(PXFMT_G16_UNORM);
CASE_STATEMENT(PXFMT_G16_SNORM);
CASE_STATEMENT(PXFMT_G32_UNORM);
CASE_STATEMENT(PXFMT_G32_SNORM);
CASE_STATEMENT(PXFMT_G16_FLOAT);
CASE_STATEMENT(PXFMT_G32_FLOAT);

// GL_BLUE
CASE_STATEMENT(PXFMT_B8_UNORM);
CASE_STATEMENT(PXFMT_B8_SNORM);
CASE_STATEMENT(PXFMT_B16_UNORM);
CASE_STATEMENT(PXFMT_B16_SNORM);
CASE_STATEMENT(PXFMT_B32_UNORM);
CASE_STATEMENT(PXFMT_B32_SNORM);
CASE_STATEMENT(PXFMT_B16_FLOAT);
CASE_STATEMENT(PXFMT_B32_FLOAT);

// GL_ALPHA
CASE_STATEMENT(PXFMT_A8_UNORM);
CASE_STATEMENT(PXFMT_A8_SNORM);
CASE_STATEMENT(PXFMT_A16_UNORM);
CASE_STATEMENT(PXFMT_A16_SNORM);
CASE_STATEMENT(PXFMT_A32_UNORM);
CASE_STATEMENT(PXFMT_A32_SNORM);
CASE_STATEMENT(PXFMT_A16_FLOAT);
CASE_STATEMENT(PXFMT_A32_FLOAT);

// GL_RG
CASE_STATEMENT(PXFMT_RG8_UNORM);
CASE_STATEMENT(PXFMT_RG8_SNORM);
CASE_STATEMENT(PXFMT_RG16_UNORM);
CASE_STATEMENT(PXFMT_RG16_SNORM);
CASE_STATEMENT(PXFMT_RG32_UNORM);
CASE_STATEMENT(PXFMT_RG32_SNORM);
CASE_STATEMENT(PXFMT_RG16_FLOAT);
CASE_STATEMENT(PXFMT_RG32_FLOAT);

// GL_RGB
CASE_STATEMENT(PXFMT_RGB8_UNORM);
CASE_STATEMENT(PXFMT_RGB8_SNORM);
CASE_STATEMENT(PXFMT_RGB16_UNORM);
CASE_STATEMENT(PXFMT_RGB16_SNORM);
CASE_STATEMENT(PXFMT_RGB32_UNORM);
CASE_STATEMENT(PXFMT_RGB32_SNORM);
CASE_STATEMENT(PXFMT_RGB16_FLOAT);
CASE_STATEMENT(PXFMT_RGB32_FLOAT);

CASE_STATEMENT(PXFMT_RGB332_UNORM);
CASE_STATEMENT(PXFMT_RGB233_UNORM);
CASE_STATEMENT(PXFMT_RGB565_UNORM);
CASE_STATEMENT(PXFMT_RGB565REV_UNORM);
CASE_STATEMENT(PXFMT_RGB5999_REV);
CASE_STATEMENT(PXFMT_RGB10F_11F_11F);

// GL_BGR
CASE_STATEMENT(PXFMT_BGR8_UNORM);
CASE_STATEMENT(PXFMT_BGR8_SNORM);
CASE_STATEMENT(PXFMT_BGR16_UNORM);
CASE_STATEMENT(PXFMT_BGR16_SNORM);
CASE_STATEMENT(PXFMT_BGR32_UNORM);
CASE_STATEMENT(PXFMT_BGR32_SNORM);
CASE_STATEMENT(PXFMT_BGR16_FLOAT);
CASE_STATEMENT(PXFMT_BGR32_FLOAT);

// GL_RGBA
CASE_STATEMENT(PXFMT_RGBA8_UNORM);
CASE_STATEMENT(PXFMT_RGBA8_SNORM);
CASE_STATEMENT(PXFMT_RGBA16_UNORM);
CASE_STATEMENT(PXFMT_RGBA16_SNORM);
CASE_STATEMENT(PXFMT_RGBA32_UNORM);
CASE_STATEMENT(PXFMT_RGBA32_SNORM);
CASE_STATEMENT(PXFMT_RGBA16_FLOAT);
CASE_STATEMENT(PXFMT_RGBA32_FLOAT);

CASE_STATEMENT(PXFMT_RGBA4_UNORM);
CASE_STATEMENT(PXFMT_RGBA4REV_UNORM);
CASE_STATEMENT(PXFMT_RGB5A1_UNORM);
CASE_STATEMENT(PXFMT_A1RGB5_UNORM);
CASE_STATEMENT(PXFMT_RGBA8888_UNORM);
CASE_STATEMENT(PXFMT_RGB10A2_UNORM);
CASE_STATEMENT(PXFMT_A2RGB10_UNORM);

// GL_BGRA
CASE_STATEMENT(PXFMT_BGRA8_UNORM);
CASE_STATEMENT(PXFMT_BGRA8_SNORM);
CASE_STATEMENT(PXFMT_BGRA16_UNORM);
CASE_STATEMENT(PXFMT_BGRA16_SNORM);
CASE_STATEMENT(PXFMT_BGRA32_UNORM);
CASE_STATEMENT(PXFMT_BGRA32_SNORM);
CASE_STATEMENT(PXFMT_BGRA16_FLOAT);
CASE_STATEMENT(PXFMT_BGRA32_FLOAT);

CASE_STATEMENT(PXFMT_BGRA4_UNORM);
CASE_STATEMENT(PXFMT_BGRA4REV_UNORM);
CASE_STATEMENT(PXFMT_BGR5A1_UNORM);
CASE_STATEMENT(PXFMT_A1BGR5_UNORM);
CASE_STATEMENT(PXFMT_BGRA8888_UNORM);
CASE_STATEMENT(PXFMT_BGR10A2_UNORM);
CASE_STATEMENT(PXFMT_A2BGR10_UNORM);

// GL_LUMINANCE
CASE_STATEMENT(PXFMT_L8_UNORM);
CASE_STATEMENT(PXFMT_L8_SNORM);
CASE_STATEMENT(PXFMT_L16_UNORM);
CASE_STATEMENT(PXFMT_L16_SNORM);
CASE_STATEMENT(PXFMT_L32_UNORM);
CASE_STATEMENT(PXFMT_L32_SNORM);
CASE_STATEMENT(PXFMT_L16_FLOAT);
CASE_STATEMENT(PXFMT_L32_FLOAT);

// GL_LUMINANCE_ALPHA
CASE_STATEMENT(PXFMT_LA8_UNORM);
CASE_STATEMENT(PXFMT_LA8_SNORM);
CASE_STATEMENT(PXFMT_LA16_UNORM);
CASE_STATEMENT(PXFMT_LA16_SNORM);
CASE_STATEMENT(PXFMT_LA32_UNORM);
CASE_STATEMENT(PXFMT_LA32_SNORM);
CASE_STATEMENT(PXFMT_LA16_FLOAT);
CASE_STATEMENT(PXFMT_LA32_FLOAT);

// GL_RED_INTEGER
CASE_STATEMENT(PXFMT_R8_UINT);
CASE_STATEMENT(PXFMT_R8_SINT);
CASE_STATEMENT(PXFMT_R16_UINT);
CASE_STATEMENT(PXFMT_R16_SINT);
CASE_STATEMENT(PXFMT_R32_UINT);
CASE_STATEMENT(PXFMT_R32_SINT);

// GL_GREEN_INTEGER
CASE_STATEMENT(PXFMT_G8_UINT);
CASE_STATEMENT(PXFMT_G8_SINT);
CASE_STATEMENT(PXFMT_G16_UINT);
CASE_STATEMENT(PXFMT_G16_SINT);
CASE_STATEMENT(PXFMT_G32_UINT);
CASE_STATEMENT(PXFMT_G32_SINT);

// GL_BLUE_INTEGER
CASE_STATEMENT(PXFMT_B8_UINT);
CASE_STATEMENT(PXFMT_B8_SINT);
CASE_STATEMENT(PXFMT_B16_UINT);
CASE_STATEMENT(PXFMT_B16_SINT);
CASE_STATEMENT(PXFMT_B32_UINT);
CASE_STATEMENT(PXFMT_B32_SINT);

// GL_ALPHA_INTEGER
CASE_STATEMENT(PXFMT_A8_UINT);
CASE_STATEMENT(PXFMT_A8_SINT);
CASE_STATEMENT(PXFMT_A16_UINT);
CASE_STATEMENT(PXFMT_A16_SINT);
CASE_STATEMENT(PXFMT_A32_UINT);
CASE_STATEMENT(PXFMT_A32_SINT);

// GL_RG_INTEGER
CASE_STATEMENT(PXFMT_RG8_UINT);
CASE_STATEMENT(PXFMT_RG8_SINT);
CASE_STATEMENT(PXFMT_RG16_UINT);
CASE_STATEMENT(PXFMT_RG16_SINT);
CASE_STATEMENT(PXFMT_RG32_UINT);
CASE_STATEMENT(PXFMT_RG32_SINT);

// GL_RGB_INTEGER
CASE_STATEMENT(PXFMT_RGB8_UINT);
CASE_STATEMENT(PXFMT_RGB8_SINT);
CASE_STATEMENT(PXFMT_RGB16_UINT);
CASE_STATEMENT(PXFMT_RGB16_SINT);
CASE_STATEMENT(PXFMT_RGB32_UINT);
CASE_STATEMENT(PXFMT_RGB32_SINT);

CASE_STATEMENT(PXFMT_RGB332_UINT);
CASE_STATEMENT(PXFMT_RGB233_UINT);
CASE_STATEMENT(PXFMT_RGB565_UINT);
CASE_STATEMENT(PXFMT_RGB565REV_UINT);

// GL_BGR_INTEGER
CASE_STATEMENT(PXFMT_BGR8_UINT);
CASE_STATEMENT(PXFMT_BGR8_SINT);
CASE_STATEMENT(PXFMT_BGR16_UINT);
CASE_STATEMENT(PXFMT_BGR16_SINT);
CASE_STATEMENT(PXFMT_BGR32_UINT);
CASE_STATEMENT(PXFMT_BGR32_SINT);

// GL_RGBA_INTEGER
CASE_STATEMENT(PXFMT_RGBA8_UINT);
CASE_STATEMENT(PXFMT_RGBA8_SINT);
CASE_STATEMENT(PXFMT_RGBA16_UINT);
CASE_STATEMENT(PXFMT_RGBA16_SINT);
CASE_STATEMENT(PXFMT_RGBA32_UINT);
CASE_STATEMENT(PXFMT_RGBA32_SINT);

CASE_STATEMENT(PXFMT_RGBA4_UINT);
CASE_STATEMENT(PXFMT_RGBA4REV_UINT);
CASE_STATEMENT(PXFMT_RGB5A1_UINT);
CASE_STATEMENT(PXFMT_A1RGB5_UINT);
CASE_STATEMENT(PXFMT_RGBA8REV_UINT);
CASE_STATEMENT(PXFMT_RGB10A2_UINT);
CASE_STATEMENT(PXFMT_A2RGB10_UINT);

// GL_BGRA_INTEGER
CASE_STATEMENT(PXFMT_BGRA8_UINT);
CASE_STATEMENT(PXFMT_BGRA8_SINT);
CASE_STATEMENT(PXFMT_BGRA16_UINT);
CASE_STATEMENT(PXFMT_BGRA16_SINT);
CASE_STATEMENT(PXFMT_BGRA32_UINT);
CASE_STATEMENT(PXFMT_BGRA32_SINT);

CASE_STATEMENT(PXFMT_BGRA4_UINT);
CASE_STATEMENT(PXFMT_BGRA4REV_UINT);
CASE_STATEMENT(PXFMT_BGR5A1_UINT);
CASE_STATEMENT(PXFMT_A1BGR5_UINT);
CASE_STATEMENT(PXFMT_BGRA8REV_UINT);
CASE_STATEMENT(PXFMT_BGR10A2_UINT);
CASE_STATEMENT(PXFMT_A2BGR10_UINT);

// GL_DEPTH_COMPONENT
CASE_STATEMENT(PXFMT_D8_UNORM);
CASE_STATEMENT(PXFMT_D8_SNORM);
CASE_STATEMENT(PXFMT_D16_UNORM);
CASE_STATEMENT(PXFMT_D16_SNORM);
CASE_STATEMENT(PXFMT_D32_UNORM);
CASE_STATEMENT(PXFMT_D32_SNORM);
CASE_STATEMENT(PXFMT_D16_FLOAT);
CASE_STATEMENT(PXFMT_D32_FLOAT);

// GL_STENCIL_INDEX
CASE_STATEMENT(PXFMT_S8_UINT);
CASE_STATEMENT(PXFMT_S8_SINT);
CASE_STATEMENT(PXFMT_S16_UINT);
CASE_STATEMENT(PXFMT_S16_SINT);
CASE_STATEMENT(PXFMT_S32_UINT);
CASE_STATEMENT(PXFMT_S32_SINT);
CASE_STATEMENT(PXFMT_S16_FLOAT);
CASE_STATEMENT(PXFMT_S32_FLOAT);

// GL_DEPTH_STENCIL
CASE_STATEMENT(PXFMT_D24_UNORM_S8_UINT);
CASE_STATEMENT(PXFMT_D32_FLOAT_S8_UINT);

    // FIXME: Compressed cases aren't needed in the normal switch statements.
    // They are needed in the switch statements for the compressed code.  Need
    // to fix that!

// FXT1 compressed texture internalformats
CASE_STATEMENT(PXFMT_COMPRESSED_RGB_FXT1);
CASE_STATEMENT(PXFMT_COMPRESSED_RGBA_FXT1);

// S3TC/DXT compressed texture internalformats
CASE_STATEMENT(PXFMT_COMPRESSED_RGB_DXT1);
CASE_STATEMENT(PXFMT_COMPRESSED_RGBA_DXT1);
CASE_STATEMENT(PXFMT_COMPRESSED_SRGB_DXT1);
CASE_STATEMENT(PXFMT_COMPRESSED_SRGB_ALPHA_DXT1);
CASE_STATEMENT(PXFMT_COMPRESSED_RGBA_DXT3);
CASE_STATEMENT(PXFMT_COMPRESSED_SRGB_ALPHA_DXT3);
CASE_STATEMENT(PXFMT_COMPRESSED_RGBA_DXT5);
CASE_STATEMENT(PXFMT_COMPRESSED_SRGB_ALPHA_DXT5);

// Note: Not handling the OpenGL-ES 1.x ETC1 compressed texture internalformat

// ETC2 compressed texture internalformats
CASE_STATEMENT(PXFMT_COMPRESSED_RGB8_ETC2);
CASE_STATEMENT(PXFMT_COMPRESSED_SRGB8_ETC2);
CASE_STATEMENT(PXFMT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2);
CASE_STATEMENT(PXFMT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2);
CASE_STATEMENT(PXFMT_COMPRESSED_RGBA8_ETC2_EAC);
CASE_STATEMENT(PXFMT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC);
CASE_STATEMENT(PXFMT_COMPRESSED_R11_EAC);
CASE_STATEMENT(PXFMT_COMPRESSED_SIGNED_R11_EAC);
CASE_STATEMENT(PXFMT_COMPRESSED_RG11_EAC);
CASE_STATEMENT(PXFMT_COMPRESSED_SIGNED_RG11_EAC);
